package com.mdb.open.trade.service.product;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mdb.bc.database.mybatisplus.SuperService;
import com.mdb.open.trade.common.MdbDataSource;
import com.mdb.open.trade.domain.po.product.Product;
import com.mdb.open.trade.mapper.product.ProductMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 类描述：
 *  产品基础信息表 服务类
 *
 * @author liuyi
 * @date 2019-07-08
 */
@Service
@DS(MdbDataSource.PRODUCT)
public class ProductService extends SuperService<ProductMapper, Product> {

    public List<Product> listAll(String status) {
        return this.list(new QueryWrapper<Product>().lambda().eq(Product::getStatus, status));
    }

    public Product getByCode(String prodCode) {
        return this.baseMapper.selectOne(new LambdaQueryWrapper<Product>().eq(Product::getProdCode, prodCode));
    }
}
